package blog.network;

import org.xmlpull.v1.XmlPullParserException;

/**
 * When XMLRPC goes wrong, it uses faults to indicate a problem.
 * 
 */
public class XmlRpcFault extends Exception
{

	/**
	 * These three fields represent three potential error levels
	 */
	public static final int NONE = 0;

	public static final int RECOVERABLE = 1;

	public static final int FATAL = 2;

	public static final int BAD_TARGET = 555;

	public static final int UNAUTHORIZED = 666;

	public static final int USER_HAS_NO_BLOGS = 777;

	public static final int PARSE_FAILURE = 999;

	/**
	 * The fault code of the exception.
	 */
	public final int code;

	/**
	 * This is the sole constructor for the KxmlRpcException class.
	 * @param code an integer representing the error code
	 * @param message a String containing the error message
	 */
	public XmlRpcFault(int code, String msg)
	{
		super( msg );
		this.code = code;
	}//end KXmlRpcFault( int, String )

	public XmlRpcFault(XmlPullParserException parseEx)
	{
		super( "Parse Exception: " + parseEx.getMessage( ) );
		this.code = PARSE_FAILURE;
	}

}//class KXmlRpcFault